﻿<%@ Page Language="C#" MasterPageFile="~/master.master" %>
<asp:Content ID="Content2" ContentPlaceHolderID="pagetitle" runat="Server">
    Download
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="pagemaincontent" runat="Server">
    <style type="text/css">
        #container
        {
            width: 300px;
            margin: auto;
        }
        #treeview
        {
            margin-top: 10px;
            margin-bottom: 5px;
        }
        
        #treeview div
        {
            margin-left: 30px;
        }
        #treeview > table
        {
            padding: 5px 45px 2px 5px;
            border-bottom: 3px solid #555;
        }
        #treeview hr
        {
            margin-top: 7px;
            margin-bottom: 3px;
            border: 1px dashed #555;
        }
        
        .treeviewparent
        {
            padding-top: 50px;
            border-top: 1px solid red;
        }
        .selectall
        {
            margin: 0px 70px;
            color: #969696;
            font-size: 12px;
        }
        #downloadbutton
        {
            margin-top: 60px;
        }
    </style>
    <link rel="stylesheet" href="css/overcast/jquery-ui-1.8.20.custom.css" />
    <script type="text/javascript" src="js/jquery-ui-1.8.20.custom.min.js"></script>
    <link rel="stylesheet" href="css/checkbox.css" />
    <script type="text/javascript" src="js/ui.checkbox.js"></script>
    <script type="text/javascript" src="js/jquery.bt.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $("input[type='checkbox']").checkBox();
            $("input[type='button']").button();

            $("#treeview > table > tbody > tr > td:not(:first)").prepend("<hr/>");

            $("input:checkbox").prop("checked", true);

            $("#checkAll").click(function () {
                $("#treeview").find("input:checkbox").prop("checked", $(this).is(':checked'));
            });

            $("#treeview input:checkbox").click(function () {
                $(this).parent().find("div input:checkbox").prop("checked", $(this).is(':checked'));
                if (!$(this).is(':checked')) {
                    var parent = $(this).closest("div");
                    if (parent.attr('id') != 'treeview')
                        parent.parent().find("input:checkbox:first").prop("checked", false);
                }
            });
            /*
            $('#treeview > table > tbody > tr> td').bt("Contents osdfsdfsdfsdf the tip <br/>is prsdfsfsdf sdfsdfsdfdsfsd fsfdodss sssss<br/>ssssfsdfvided in the .bt() call", {
            fill : '#444444',
            cornerRadius : 10,
            strokeWidth : 0,
            shadow : true,
            shadowOffsetX : 3,
            shadowOffsetY : 3,
            shadowBlur : 8,
            shadowColor : 'rgba(0,0,0,.9)',
            shadowOverlap : false,
            noShadowOpts : {
            strokeStyle : '#999',
            strokeWidth : 2
            },
            positions : ['right', 'left']

            });
            */
        });

        function downloadscript() {

            var script = "";
            $("#treeview input[type='checkbox']:checked").each(function () {
                script += $(this).attr("name") + " ";
            });

            $("#downloadpage").attr("src", "jsdownload.aspx?script=" + script);
        }


    </script>
    <iframe id="downloadpage" style="display: none"></iframe>
    <div id="container">
        <h3 title="">
            Build your download:
        </h3>
        <div id="treeview">
            <table>
                <tr>
                    <td>
                        <input id="checkbox-01" type="checkbox" name="postback" />
                        ajax postback
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="Checkbox3" type="checkbox" name="databind" />
                        client repeater
                        <div>
                            <table>
                                <tr>
                                    <td>
                                        <input id="Checkbox2" type="checkbox" name="jTemplates" />
                                        <a href="javascript:window.open('http://jtemplates.tpython.com/')">jTemplates</a>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input id="Checkbox4" type="checkbox" name="pagination" />
                                        <a href="javascript:window.open('http://d-scribe.de/webtools/jquery-pagination/demo/demo_options.htm')">
                                            Pagination </a>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="Checkbox5" type="checkbox" name="object" />
                        object helper
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="Checkbox6" type="checkbox" name="dataformat" />
                        data formator
                        <div>
                            <table>
                                <tr>
                                    <td>
                                        <input id="Checkbox7" type="checkbox" name="datejs" />
                                        <a href="javascript:window.open('http://www.datejs.com/')">datejs</a>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="selectall">
            <input id="checkAll" type="checkbox" />
            <span>Select/Deselet All</span>
        </div>
        <input id="downloadbutton" type="button" value="download the script" onclick="downloadscript()" />
    </div>
</asp:Content>
